#include "ProjectionImage.h"

ProjectionImage::ProjectionImage(QWidget *parent)
	: QLabel(parent)
{
	//ui.setupUi(this);
	setMouseTracking(true);
	mButton = NO_BUTTON;
}

ProjectionImage::~ProjectionImage()
{

}

void  ProjectionImage::mousePressEvent(QMouseEvent * mouseEvent)
{
	if (mouseEvent->button() == Qt::LeftButton)
	{
		mX = mouseEvent->x();
		mY = mouseEvent->y();
		mButton = LEFT_BUTTON;
		emit getXY(mX, mY, true, LEFT_BUTTON);
	}
}

void  ProjectionImage::mouseReleaseEvent(QMouseEvent * mouseEvent)
{
	mButton = NO_BUTTON;
}

void  ProjectionImage::mouseMoveEvent (QMouseEvent * mouseEvent)
{
		mX = mouseEvent->x();
		mY = mouseEvent->y();
		emit getXY(mX, mY, false, mButton);
}

void  ProjectionImage::leaveEvent (QEvent * e)
{
	emit removeCurrentInformation();
}